var limsTrainEffect = Gikam.getPageObject({

    getEditListColumns: function (editor) {
        return [{
            checkbox: true
        }, {
            index: true
        }, {
            field: 'status',
            title: 'T_LIMS_TRAIN_EFFECT.STATUS',
            type: 'select',
            search: true,
            category: 'sys',
            param: {
                codeCategoryId: 'trainState'
            },
        }, {
            field: 'ext$.traincategory',
            title: 'T_LIMS_TRAIN_RECORD.TRAINCATEGORY',
            type: 'select',
            search: true,
            category: 'sys',
            param: {
                codeCategoryId: 'trainCategory'
            },
        }, {
            field: 'ext$.traintopics',
            title: 'T_LIMS_TRAIN_RECORD.TRAINTOPICS',
            validators: ['strLength[0,24]', 'notEmpty']
        }, {
            field: 'ext$.traincontent',
            title: 'T_LIMS_TRAIN_RECORD.TRAINCONTENT',
        }, {
            field: 'ext$.traintime',
            title: 'T_LIMS_TRAIN_RECORD.TRAINTIME',
            type: 'dateTime',
            width: 160
        }, {
            field: 'ext$.trainlocation',
            title: 'T_LIMS_TRAIN_RECORD.TRAINLOCATION',
        }, {
            field: 'ext$.traininstructor',
            title: 'T_LIMS_TRAIN_RECORD.TRAININSTRUCTOR',
        }, {
            field: 'type',
            title: 'T_LIMS_TRAIN_EFFECT.TYPE',
            firstBlank: false,
            type: 'select',
            category: 'sys',
            param: {
                codeCategoryId: 'trainEffect'
            },
            validators: ['notEmpty']
        }, {
            field: 'realTime',
            title: 'T_LIMS_TRAIN_EFFECT.REALTIME',
            type: 'dateTime',
            width: 160,
            validators: ['notEmpty']
        }, {
            field: 'createdByName',
            title: 'T_LIMS_INDEX.CREATEDBYNAME',
            width: 140
        }, {
            field: 'trainPerson',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSON',
            type: 'choose',
            category: 'mult-user',
            editor: editor,
            onAfterChoose: function (rows, index) {
                if (rows && rows.length > 0) {
                    var trainPerson = rows.map(u => u.userName).join(',')
                    var trainPersonId = rows.map(u => u.id).join(',')
                    this.setData({
                        trainPersonId: trainPersonId,
                        trainPerson: trainPerson,
                        index: index
                    })
                }
            },
            onClean: function (field, value, index) {
                this.setData({
                    trainPersonId: '',
                    trainPerson: '',
                    index: index
                })
            },
            validators: ['notEmpty']
        }, {
            field: 'createdTime',
            title: 'T_LIMS_INDEX.CREATEDTIME',
            width: 160
        }]
    },

    getBaseInfoFormFields: function () {
        return [{
            field: 'trainTopics',
            title: 'T_LIMS_TRAIN_RECORD.TRAINTOPICS',
            type: 'choose',
            preInsert: true,
            category: 'trainRecord',
            single: true,
            validators: ['notEmpty'],
            onAfterChoose: function (rows, index) {
                if (rows) {
                    this.setData({
                        recordId: rows[0].id,
                        trainTopics: rows[0].trainTopics,
                        trainPerson: rows[0].trainPerson,
                        trainPersonId: rows[0].trainPersonId
                    })
                }
            },
            onClean: function (field, value, rowIndex) {
                this.setData({
                    recordId: '',
                    trainTopics: '',
                    trainPerson: '',
                    trainPersonId: ''
                })
            }
        }, {
            field: 'type',
            title: 'T_LIMS_TRAIN_EFFECT.TYPE',
            preInsert: true,
            firstBlank: false,
            type: 'select',
            category: 'sys',
            param: {
                codeCategoryId: 'trainEffect'
            },
            validators: ['strLength[0,24]', 'notEmpty']
        }, {
            field: 'realTime',
            title: 'T_LIMS_TRAIN_EFFECT.REALTIME',
            type: 'dateTime',
            preInsert: true,
            validators: ['notEmpty'],
        }, {
            field: 'trainPerson',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSON',
            validators: ['strLength[0,160]', 'notEmpty'],
            type: 'choose',
            category: 'mult-user',
            preInsert: true,
            onAfterChoose: function (rows, index) {
                if (rows && rows.length > 0) {
                    var trainPerson = rows.map(u => u.userName).join(',')
                    var trainPersonId = rows.map(u => u.id).join(',')
                    this.setData({
                        trainPersonId: trainPersonId,
                        trainPerson: trainPerson
                    })
                }
            },
            onClean: function () {
                this.setData({
                    trainPersonId: '',
                    trainPerson: ''
                })
            },
        },]
    },

    getAuditListColumns: function () {
        return [{
            checkbox: true
        },{index: true}, Gikam.status.getBpmnColumn(limsTrainEffect.workflow.dbTable), {
            field: 'type',
            title: 'T_LIMS_TRAIN_EFFECT.TYPE'
        }, {
            field: 'realTime',
            title: 'T_LIMS_TRAIN_EFFECT.REALTIME'
        }, {
            field: 'trainPerson',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSON'
        }, {
            field: 'trainPersonId',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSONID'
        }];
    },

    getSearchListColumns: function () {
        return [{
            checkbox: true
        }, Gikam.status.getBpmnColumn(limsTrainEffect.workflow.dbTable), {
            field: 'type',
            title: 'T_LIMS_TRAIN_EFFECT.TYPE'
        }, {
            field: 'realTime',
            title: 'T_LIMS_TRAIN_EFFECT.REALTIME'
        }, {
            field: 'trainPerson',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSON'
        }, {
            field: 'trainPersonId',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSONID'
        }];
    },

    getChooseListColumns: function () {
        return [{index: true},{
            field: 'type',
            title: 'T_LIMS_TRAIN_EFFECT.TYPE'
        }, {
            field: 'realTime',
            title: 'T_LIMS_TRAIN_EFFECT.REALTIME'
        }, {
            field: 'trainPerson',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSON'
        }, {
            field: 'trainPersonId',
            title: 'T_LIMS_TRAIN_EFFECT.TRAINPERSONID'
        },];
    },

    baseUrl: IFM_CONTEXT + '/secure/basemodule/rm/train-effects'
});
